<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript" src="./ajax.js"></script>
    <script>
        // Promise 异常

        // ajax('/part-1/javascript-asyn/code/test.json')
        //     .then(
        //         function onFulfilled(value){
        //             console.log('onFulfilled',value)
        //             return ajax('/test.json')
        //         } ,
        //         function onReject(error){
        //             console.log('onReject',error)
        //         } //onReject只能捕获初始Promise的异常
        //     )
       
        ajax('/part-1/javascript-asyn/code/test1.json')
            .then(function onFulfilled(value){
                console.log('onFulfilled',value)
                return ajax('/test.json')
            }) 
            .catch( function onReject(error){ //会基于上一个then返回的promise去捕获异常
                console.log('onReject',error)
            })
    </script>
</head>
<body>
    
</body>
</html>